package com.swxc.smartorder.ui.activity

import android.os.Bundle
import android.view.View
import com.swxc.smartorder.R
import com.swxc.smartorder.adapter.AdapterTab
import com.swxc.smartorder.ui.base.BaseActivity
import kotlinx.android.synthetic.main.activity_order.*

class OrderActivity : BaseActivity(), View.OnClickListener {
    override fun onClick(v: View?) {
        when (v?.id) {
            R.id.iv_back -> finish()
            R.id.iv_search -> readyGo(OrderSearchActivity::class.java)
        }
    }


    private var mTitleList: ArrayList<String>? = null
    private var mAdapter: AdapterTab? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_order)
        initData()
        initViewAndEvent()
    }

    private fun initViewAndEvent() {
        iv_back.setOnClickListener(this)
        iv_search.setOnClickListener(this)


    }

    private fun initData() {

        mTitleList = ArrayList()
        mTitleList?.add("all")
        mTitleList?.add("accepted")
        mTitleList?.add("commited")
        mTitleList?.add("untreated")
        mAdapter = AdapterTab(supportFragmentManager, mTitleList!!)
        viewpager.adapter = mAdapter
        viewpager.currentItem = 0
        viewpager.offscreenPageLimit = 4
        tab_layout.setViewPager(viewpager)

    }

}
